- Double-click Window1 to switch to Code view and create the Window1_Loaded event handler.
- In Code view, add the following import statement to the top of the page:
Visual Basic |
Copy Code
|
Imports C1.WPF
|
C# |
Copy Code
|
using C1.WPF;
|
- In a WPF application, add code to the Window_Loaded event handler so that it appears like the following:
Visual Basic |
Copy Code
|
Private Sub Window1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
UpdateGradient()
End Sub
|
C# |
Copy Code
|
private void Window_Loaded(object sender, RoutedEventArgs e)
{
UpdateGradient();
}
|
- Add the following code just after the Window1_Loaded event handler to update the gradient values:
Visual Basic |
Copy Code
|
Private Sub UpdateGradient()
If IsLoaded Then
Me.goldcol.Offset = Me.c1rs1.LowerValue
Me.blackcol.Offset = Me.c1rs1.UpperValue
End If
End Sub
|
C# |
Copy Code
|
UpdateGradient()
{
if (IsLoaded)
{
this.goldcol.Offset = this.c1rs1.LowerValue;
this.blackcol.Offset = this.c1rs1.UpperValue;
}
}
|
- Return to Design view.
- Click once on the C1RangeSlider control to select it and then navigate to the Properties window.
- Click the lightning bolt Events icon at the top of the Properties window to view events.
- Double-click the LowerValueChanged event to switch to Code view and create the c1rs1_LowerValueChanged event handler. Return to Design view and repeat this step with the UpperValueChanged event to create the c1rs1_UpperValueChanged event handler.
- Add code to the c1rs1_LowerValueChanged event handler so that it appears like the following:
Visual Basic |
Copy Code
|
Private Sub c1rs1_LowerValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.LowerValueChanged
UpdateGradient()
End Sub
|
C# |
Copy Code
|
private void c1rs1_LowerValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
- Add code to the c1rs1_UpperValueChanged event handler so that it appears like the following:
Visual Basic |
Copy Code
|
Private Sub c1rs1_UpperValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.UpperValueChanged
UpdateGradient()
End Sub
|
C# |
Copy Code
|
c1rs1_UpperValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.
- Select View | Code to switch to Code view.
- In Code view, add the following import statement to the top of the page:
Visual Basic |
Copy Code
|
Imports C1.Silverlight
|
C# |
Copy Code
|
using C1.Silverlight;
|
- Add the following code just after the page's constructor to update the gradient values:
Visual Basic |
Copy Code
|
Private Sub UpdateGradient()
If c1rs1 IsNot Nothing Then
Me.goldcol.Offset = Me.c1rs1.LowerValue
Me.blackcol.Offset = Me.c1rs1.UpperValue
End If
End Sub
|
C# |
Copy Code
|
UpdateGradient()
{
if (c1rs1 != null)
{
this.goldcol.Offset = this.c1rs1.LowerValue;
this.blackcol.Offset = this.c1rs1.UpperValue;
}
}
|
- Return to Design view.
- Click once on the C1RangeSlider control to select it and then navigate to the Properties window.
- Click the lightning bolt Events icon at the top of the Properties window to view events.
- Double-click the LowerValueChanged event to switch to Code view and create the c1rs1_LowerValueChanged event handler. Return to Design view and repeat this step with the UpperValueChanged event to create the c1rs1_UpperValueChanged event handler.
- Add the c1rs1_LowerValueChanged event handler so that it appears like the following:
Visual Basic |
Copy Code
|
Private Sub c1rs1_LowerValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.LowerValueChanged
UpdateGradient()
End Sub
|
C# |
Copy Code
|
private void c1rs1_LowerValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
- Add the c1rs1_UpperValueChanged event handler so that it appears like the following:
Visual Basic |
Copy Code
|
Private Sub c1rs1_UpperValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles c1rs1.UpperValueChanged
UpdateGradient()
End Sub
|
C# |
Copy Code
|
c1rs1_UpperValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.